package P1400;

import java.util.Scanner;

/**
 * @author: zhouyang
 * @descrpition:
 * @time: 2019-10-07 13:19
 */
public class P1424_小鱼的航程 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int start = scanner.nextInt();
        int add = scanner.nextInt();
        scanner.close();
        int res = 0;
        res += add/7*5;
        add %= 7;
        for(int i=0;i<add;++i){
            start %= 7;
            if(start == 0 || start == 6) {
                ++start;
                continue;
            }
            ++res;
            ++start;
        }
        System.out.println(res*250);
    }
}
